<?php
include('global.php');		//引入全局主文件
$GLOBALS['pos'] = '<a href="#">搜索结果</a>';
$GLOBALS['title'] = '图书管理系统 - 搜索结果';
if(isset($_POST['sbtn']))
{
	$start = array_sum(explode(' ', microtime()));
	$result = $action->search_fun($_POST);
	$kw = htmlspecialchars(mysql_real_escape_string(trim($_POST['search'])));
	$end = array_sum(explode(' ', microtime()));	//搜索结束
}
$total = count($result)>1 ? array_pop($result) : '';
$total = $total['total'] == '' ? 0 : $total['total'];
include('public/top.php');		//引入头
?>
<div class="sp_style">
<h2>
<font style="font-size:14px; color:#F96;"><?php echo $kw;?></font>&nbsp;
搜索结果<em>共&nbsp;<font color="red"><?php echo $total;?></font>&nbsp;条结果&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
用时&nbsp;<font color="red"><?php echo sprintf('%0.6f', $end - $start);?></font>&nbsp;&nbsp;&nbsp;&nbsp;秒</em>
</h2>
<?php
if(!empty($result[0]['name']))
{
	foreach($result as $v)
	{
?>
	<dl>
    	<dt>
		<a href="book_view.php?bookid=<?php echo $v['bid'];?>"><?php echo $v['name'];?></a>
    	    <em>
				图书类别：<?php echo $v['value'];?>&nbsp;
                出版社：<?php echo $v['pstore'];?>&nbsp;
                作者：<?php echo $v['author'];?>&nbsp;
        		出版时间：<?php echo d($v['pdate']);?>&nbsp;
                可借复本：<font color="green"><?php echo $v['storage'];?></font>
        	</em>
		</dt>
    	<dd><a href="book_view.php?bookid=<?php echo $v['bid'];?>">
<?php
$v['content'] = strlen($v['content'])>= 300 ? strip_tags(str($v['content'], 0, 300), '<font>') . '......' : strip_tags(str($v['content'], 0, 300), '<font>');	//不删除font标签
echo $v['content'];
?>
        </a></dd>
    </dl>
<?php
	}
}
else
{
?>
	<dl><dd style="text-align:center;">没有搜到任何内容</dd></dl>
<?php	
}
?>
</div>
<?php echo $copyright;?>
</body>
</html>